package com.inspectortime.webapp.inspector;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.inspectortime.domain.InspectorCompany;
import com.inspectortime.repository.Repository;
import com.inspectortime.webapp.util.HttpSessionUtils;

public class RemovePaymentGatewayController implements Controller {

	private Repository repository;
	private String returnView;

	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		InspectorCompany company = HttpSessionUtils.retrieveLoggedInCompany(
				request, repository);
		company.setSimLoginId(null);
		company.setSimTransactionKey(null);
		company.save();
		ModelAndView mv = new ModelAndView(this.returnView);
		return mv;
	}

	public void setReturnView(String returnView) {
		this.returnView = returnView;
	}

	public void setRepository(Repository repository) {
		this.repository = repository;
	}

}
